<script setup lang="ts">
import {computed} from 'vue';

const props = withDefaults(
  defineProps<{
    value: any;
    item: any;
  }>(),
  {
    value: undefined,
    item: () => {},
  },
);

const {item} = props;
const emit = defineEmits<{
  'update:value': [value: any];
}>();

const value = computed({
  get: () => props.value,
  set: (value) => {
    emit('update:value', value);
  },
});
</script>

<template>
  <a-tree-select
    v-model:value="value"
    style="width: 100%"
    :dropdown-style="{maxHeight: '400px', overflow: 'auto'}"
    :placeholder="item.placeholder || '请选择'"
    :tree-data="item.options"
    tree-node-filter-prop="label"
    v-bind="item"
  />
</template>

<style lang="less" scoped></style>
